<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<center>
    <div id="app">
        <h1>姓名：{{name}}， 密码：{{pwd}}， 手机号：{{phone}}</h1>
        <button @click="getInfo()">获取用户数据</button>
    </div>
</center>
</body>

<script type="text/javascript">
    // 实例化vue对象
    let vm = new Vue({
        el: "#app",
        data: {
            name: null,
            pwd: null,
            phone: null
        },
        methods:{
            // 获取用户数据函数
            getInfo(){
                // 发起异步请求
                axios.get("./data.json")
                .then((resp)=>{
                    if (resp.status == 200) {
                        this.name = resp.data.name;
                        this.pwd = resp.data.pwd;
                        this.phone = resp.data.phone;
                    }
                }).catch((error)=>{

                })
            }
        }
    });
</script>
</html>